package services;

import java.util.List;

import javax.inject.Inject;

import mappers.JourneyMapper;
import mappers.PositionsMapper;
import models.Journey;
import models.Point;

public class JourneyService {
    @Inject
    public JourneyMapper journeyMapper;
    @Inject
    public PositionsMapper positionsMapper;
    
    public List<Journey> getJourneysByUsername(String username){
        List<Journey> journeys = journeyMapper.getJourneysDescByUsername(username);
        return journeys;
    }
    public List<Journey> getJourneysByUserId(int user_id) {
        List<Journey> journeys = journeyMapper.getJourneysDescByUserId(user_id);
        return journeys;
    }
    public List<Journey> getShareJourneysByUserId(int journey_id) {
        List<Journey> journeys = journeyMapper.getShareJourneysDescByUserId(journey_id);
        return journeys;
    }
    public List<Point> getPointsByJourney(int journey_id) {
        List<Point> points = journeyMapper.getPointsByJourney(journey_id);
        return points;
    }

	public void insertPoint(Point point) {
		positionsMapper.insertCoordinate(point);
		journeyMapper.insertJourney(point);
	}
	public void updateName(Journey journey) {
		journeyMapper.updateName(journey);
	}
	public void deleteJourney(Journey journey) {
		journeyMapper.deleteJourney(journey);
	}
}
